Những câu hỏi liên quan
Nguyễn Thị Mỹ Tiền
Xem chi tiết
ᝰᦔꫀꪑꪮꪀ
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:25

Câu 1: 

uses crt;

var st:string;

d,i,dem:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

write('Xau sau khi xoa so la: ');

for i:=1 to d do 

  if not(st[i] in ['0'..'9']) then write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln('Xau co ',dem,' dau cach');

writeln('Do dai cua xau la: ',d);

readln;

end. 

Bình luận (1)
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:26

Câu 2: 

uses crt;

const fi='kq.out'

var st1,st2:string;

f1:text;

begin

clrscr;

write('Nhap xau thu 1:'); readln(st1);

write('Nhap xau thu 2:'); readln(st2);

assign(f1,fi); rewrite(f1);

if length(st2)>length(st1) then writeln(f1,st2)

else writeln(f1,st1);

close(f1);

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:28

Câu 3: 

uses crt;

var a:array[1..100]of integer;

i,n,t,dem:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then

begin

t:=t+a[i];

inc(dem);

end;

writeln('Trung binh cong cac so chan la: ',t/dem:4:2);

readln;

end.

Bình luận (0)
Lily
Xem chi tiết
Phía sau một cô gái
23 tháng 3 2023 lúc 19:35

xau = input('Nhập xâu kí tự: ')

chu_cai, chu_so, ki_tu_khac = 0, 0, 0

for kt in xau:

      if kt.isalpha():

            chu_cai += 1

      elif kt.isdigit():

            chu_so += 1

      else:

            ki_tu_khac += 1

print('Số lượng kí tự chữ cái:', chu_cai)

print('Số lượng kí tự chữ số:', chu_so)

print('Số lượng kí tự khác:', ki_tu_khac)

Bình luận (0)
Nguyễn Thảo Vy
Xem chi tiết
Tiên Tiên
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:22

Bài 1:

uses crt;

var S:String;

vt:integer;

begin

clrscr;

Write(‘Nhap 1 xau:’); Readln(S);

While pos(‘nang’,s)>0 do

Begin

Vt:= pos(‘nang’,s);

Delete(s,vt,4);

Insert(‘mua’,s ,vt);

End;

Writeln(‘Xau sau khi thay the ’,s);

Readln;

End.

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:26

Bài 2: 

uses crt;

var st:string;

d,i,kt:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

kt:=0;

for i:=1 to d do 

  if st[i]<>st[d-i+1] then kt:=1;

if kt=0 then writeln(st,' la xau doi xung')

else writeln(st,' khong la xau doi xung');

readln;

end.

Bình luận (0)
Thangg PH
Xem chi tiết
Minh Lệ
3 tháng 4 2021 lúc 18:54

Program HOC24;

var S: string;

d,i: byte;

begin

write('S= '); readln(s);

For i:= length(s) downto 1 do write(s[i]);

writeln;

while s[length(s)]=#32 do delete(s,length(s),1);

while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);

while s[1]=#32 do delete(s,1,1);

d:=0;

for i:=1 to length(s) do d:=d+1;

write('So tu :',d);

readln

end.

Bình luận (1)
Nguyễn Lê Phước Thịnh
3 tháng 4 2021 lúc 19:16

uses crt;

var s:string[200];

i,d,dem:integer;

begin

clrscr;

write('Nhap xau:'); readln(s);

d:=length(s);

write('Xau viet theo chieu nguoc la: ');

for i:=d downto 1 do 

  write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln('So tu la: ',dem);

readln;

end.

Bình luận (1)
Do Ngoc Thao My
Xem chi tiết
Do Ngoc Thao My
Xem chi tiết
no no
Xem chi tiết
Vũ Quang Huy
20 tháng 3 2022 lúc 9:24

tham khảo

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do 

  if (not (st[i] in ['A'..'Z'])) and (not (st[i] in ['a'..'z'])) then write(st[i]);

readln;

end.

Bình luận (0)